<?php 
if(KT!='KhiThe') exit;
class banner_controller extends banner_model {
	
	public function __construct()
	{	
		global $lang;
		
		$lang['url_base'] = url_base;	
		$this->path_cur = dirname(__FILE__);	
		parent::__construct();
		parent::addObject('khithe_template');
		parent::addObject('khithe_request');
		parent::addObject('khithe_string');

		$this->lang = $lang;
	}
	public function index()
	{
        if(isset($_POST['fullname'])){
           $email = $this->isValidEmail($_POST['email']);
        }

        if( isset($_POST['fullname']) && !empty($_POST['fullname']) &&  isset($_POST['email']) && !empty($_POST['email'])&& $email == true ){
            $arr['Fullname'] = $_POST['fullname'];
            $arr['Email'] = $_POST['email'];
            parent::setSubscribed($arr);
        }

		return $this->khithe_assign(
			$this->khithe_display_template(
					dirname(__FILE__).'/banner'
				), 
				$this->lang
		);
	}

    public function index_ajax()
    {
        $r = parent::get_subscribed();
		

        /* if(!empty($r)){
            foreach($r as $k=>$row) { */
			
				include (path_lib.'/mailer/phpmailer.php');
				$mail = new mailer_phpmailer();
            $title = 'agdggasgd asdg ';
            $body = 'sdasd dasdasd asd asd asd asd asdasdasdsa ';
            $from_list = array(
                
                array(
                    'name'=>'',
                    'email'=>'viethopvn@gmail.com'
                )
            );
            $bcc_list = array(
                array(
                    'name'=>'',
                    'email'=>'viethopvn@gmail.com'
                )
            );
            $mail->send_mail_g(Emailuser,$this->_['name_sendmail'],$from_list, $title, $body, $bcc_list);
				
				echo "<pre>";
				print_r($h);
				echo "</pre>";
				


            // }
        // }

        return 'index_ajax';
    }
	
	
}
?>